.386
.MODEL flat, stdcall
OPTION CASEMAP:NONE
Include windows.inc
include kernel32.inc
include user32.inc
Include masm32.inc
Include shell32.inc
Include Comctl32.inc
Include oleaut32.inc
Include macros.asm
includelib kernel32.lib
includelib user32.lib
IncludeLib masm32.lib
IncludeLib shell32.lib
include  masm32rt.inc
include  urlmon.inc
includelib  urlmon.lib
 


 

.data
  
  HelloMsg               DB "[*] WgetEx 1.0 By Yaseng ", 0  
  szDownInfo             DB	'[+] start ownload url:%s file:%s',00Ah, 00Dh,0
 
.code
Start:
call main
invoke ExitProcess, 0     



main proc

	LOCAL szUrl[260]:BYTE
	LOCAL szFileName[260]:BYTE
	LOCAL buffer[260]:BYTE
	print SADD("[*] WgetEx 1.0 By Yaseng ",13,10)
	sub eax,eax
	invoke GetCL,1,ADDR szUrl
	.if eax != 1
       print SADD("[-] url parameter is missing",13,10) 
       call  help
       ret
	.endif
    invoke GetCL,2,ADDR szFileName
	.if eax != 1
       print SADD("[-] file parameter is missing",13,10) 
       call  help
       ret
	.endif
	  
 
	  invoke	wsprintf,addr buffer,addr szDownInfo,addr szUrl,addr szFileName
	  invoke StdOut,addr buffer
	  invoke URLDownloadToFile,0,addr szUrl,addr szFileName,0,0
	  invoke exist,ADDR szFileName
      .if eax != 1
         print SADD("[-] download av failed  !!! ",13,10) 
      .else
         print SADD("[+] download av succeed !!! ",13,10) 
      .endif
    ret
main endp


help  proc
	
	print SADD("[*] WgetEx :Thunderbolt Download program",13,10)
    print SADD("[*] Usage  :WgetEx http://yaseng.me/av.rmvb  av.rmvb",13,10)
	
	ret

help endp

 

End Start